package DatingApp;

import java.util.Vector;

import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.Manager;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.EditField;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;




public class Notifications extends MainScreen implements FieldChangeListener{
	private Vector notifications;
	private VerticalFieldManager notificationBlock;
	private ButtonFrames frames;
	
	public Notifications(){
		frames = new ButtonFrames();
		notifications = new Vector();
		populate();
		display();
		
	}
	
	public void display(){
		setTitle("Notifications");
		add(frames.getTop());
		Manager response; 
		notificationBlock = new VerticalFieldManager();
		response  = new HorizontalFieldManager();

		for (int i = 0; i < notifications.size(); i++){
			notificationBlock = new VerticalFieldManager();
			response  = new HorizontalFieldManager();
			Notify note = (Notify) notifications.elementAt(i);
			
			notificationBlock.add(new EditField("From:", note.getSender()));
			notificationBlock.add(new EditField("Time:", note.getTime() + ""));
			notificationBlock.add(new EditField("Date:", note.getDate()));
			notificationBlock.add(new EditField("Location:", note.getLocation()));
			
			response.add(new ButtonField("Accept"));
			response.add(new ButtonField("Reject"));
			response.add(new ButtonField("Ignore"));
			response.add(new ButtonField("Message"));
			notificationBlock.add(response);
			this.add(notificationBlock);
			//String recipient, String sender, double time, String date, String location
		}
		add(frames.getBottom());
	}
	
	public void populate(){
		for (int i = 0; i < 5; i++){
			notifications.addElement(new Notify("user" + i, "sender" + i, i + 1.0, "March " + i, "town" + i));
		}
	}

	public void fieldChanged(Field field, int context) {
		// TODO Auto-generated method stub
		
	}
}


class Notify{
	private String recipient, sender, date, location;
	private double time;

	public Notify(String recipient, String sender, double time, String date, String location){
		this.recipient = recipient;
		this.sender = sender;
		this.date = date;
		this.location = location;
		this.time = time;
	}
	
	
	/**
	 * @return the recipient
	 */
	public String getReceipient() {
		return recipient;
	}

	/**
	 * @return the sender
	 */
	public String getSender() {
		return sender;
	}

	/**
	 * @return the date
	 */
	public String getDate() {
		return date;
	}

	/**
	 * @return the location
	 */
	public String getLocation() {
		return location;
	}

	/**
	 * @return the time
	 */
	public double getTime() {
		return time;
	}
}